<template>
	<view>
		<navigationBar :backType="2" navigationTitle="设置" />

		<view class="wrap paddingBottom">
			<view class="wrap-userInfo">
				<view class="avatar-bg"></view>
				<view class="list">
					<view class="item flex align-center just-between">
						<view class="title f-28"> 昵称 </view>

						<input
							class="value f-28"
							placeholder="请输入昵称"
							placeholder-class="place"
						/>
					</view>

					<view class="item flex align-center just-between">
						<view class="title f-28"> 注册时间 </view>

						<picker mode="date" disabled>
							<input
								disabled
								class="value"
								placeholder="请选择注册时间"
							/>
						</picker>
					</view>

					<view class="item flex align-center just-between">
						<view class="title f-28"> 支付宝账号 </view>

						<view class="value flex align-center just-end f-28">
							<block>
								<view class="tit"> 暂无 </view>
								<view class="set"> 去设置 </view>
							</block>
						</view>
					</view>
				</view>
			</view>

			<view class="wrap-agree-list">
				<block v-for="(item, index) in agreeList" :key="index">
					<view
						class="item flex align-center just-between"
						@click="$handle(item)"
					>
						<view class="title f-28">
							{{ item.title }}
						</view>

						<image
							class="arrow"
							:src="getImageURL('common/arrow.png')"
						/>
					</view>
				</block>
			</view>
		</view>

		<view class="wrap-footer safe-area flex just-between align-center">
			<view class="item cancel f-28" @click.stop="onCancel">
				注销账号
			</view>
			<view class="item logout f-28" @click.stop="onLogout">
				退出登录
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				agreeList: [
					{
						title: "隐私协议",
						handle: function (item) {
							console.log(item.title);
						},
					},
					{
						title: "服务协议",
						handle: () => {
							console.log("BB");
						},
					},
					{
						title: "屏蔽列表",
						handle: () => {
							console.log("CC");
						},
					},
				],
			};
		},
		methods: {
			/**
			 * 注销账号
			 */
			onCancel() {
				console.log("注销");
			},
			/**
			 * 退出登录
			 */
			onLogout() {
				console.log("退出");
			},
		},
	};
</script>

<style lang="scss" scoped>
	.wrap {
		--bottom-height: 140rpx;

		.wrap-userInfo {
			width: 100%;
			background-color: white;
			padding-top: 60rpx;

			.avatar-bg {
				margin: 0 auto;
				width: 126rpx;
				height: 126rpx;
				border-radius: 50%;
				overflow: hidden;
				background-color: red;

				image {
					width: 100%;
					height: 100%;
					border-radius: 50%;
				}
			}

			.list {
				margin-top: 50rpx;
				width: 100%;
				overflow: hidden;

				.item {
					padding: 30rpx;
					width: 100%;
					box-sizing: border-box;
					overflow: hidden;

					.title {
						color: $title-color;
					}

					.value {
						text-align: right;
						margin-left: 20rpx;
						width: 500rpx;
						height: 40rpx;
						color: #999999;

						.tit {
							color: #999999;
						}
						.set {
							margin-left: 14rpx;
							color: $theme-color;
						}
					}
					.place {
						color: #999999;
					}
				}
			}
		}

		.wrap-agree-list {
			margin-top: 20rpx;
			width: 100%;
			overflow: hidden;
			padding: 0rpx 30rpx;
			box-sizing: border-box;
			background-color: white;

			.item {
				width: 100%;
				padding: 30rpx 0;
				overflow: hidden;

				.title {
					color: $title-color;
				}
			}
		}
	}

	.wrap-footer {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 128rpx;
		z-index: 10;
		background-color: white;

		.item {
			width: 330rpx;
			height: 94rpx;
			line-height: 94rpx;
			text-align: center;
			border-radius: 50rpx;
			overflow: hidden;
		}

		.cancel {
			margin-left: 20rpx;
			border: 2rpx solid $theme-color;
			color: $theme-color;
		}

		.logout {
			margin-right: 20rpx;
			background: $grad-theme-color;
			color: $bg-text-color;
		}
	}
</style>
